import React, {Fragment} from "react";
import {Checkbox, Icon, Tooltip /** , Input, Radio */} from "antd";
import {connect} from "dva";
// import Zcon from "@cbd/icon";
import {openNotificationWithIcon} from "utils/comm";
// import NoticeUserAdd from "components/NoticeUserAdd/NoticeUserAdd";
// import _get from 'lodash/get';
import BaseDuedateSetting from "./BaseDuedateSetting";
// import UserSelectorModal from "./UserSelectorModal";
// import MessageEditModal from "./MessageEditModal";

import styles from "./Pannel.less";

export const alertCodePattern = /^[a-zA-Z_][a-zA-Z_0-9-]*$/;

@connect(({FlowChart, notice_msg: noticeModel}) => ({
  noticeTypeData: FlowChart.noticeTypeData,
  noticeThemeTypeList: noticeModel.noticeThemeTypeList,
}))
class BackComment extends BaseDuedateSetting {
  constructor(props) {
    super(props);
    this.state = {
      alertCodes: [],
      // 用来渲染用户选择弹窗的属性
      users: [],
      channels: [],
      userSelectorVisible: false,
      // record: [],
      noticeType: '', // 超时/预警
    };
    this.openNotificationWithIcon = openNotificationWithIcon.bind(this);
  }

  render() {
    const {codeRefModel} = this.props;
    const showCheck = codeRefModel?.model.properties?.requiredRollbackComment;
    // timeoutSetting = timeoutSetting || baseTimeoutSetting;
    // const { warningSetting = {} } = timeoutSetting;
    // const { warningRegular: alerts = [] } = warningSetting;
    // const showReCommentdate = timeoutSetting.isRequiredComment === "true";
    // isRequiredComment
    return (
      <>
        <div className={styles.content_item} style={{display: "block"}}>
          <span className={styles.item_label} style={{paddingBottom: 0}}>
            <Checkbox
              checked={showCheck === '1'}
              onChange={(e) => this.onBackChecked(e)}
            >
              回退必填意见
            </Checkbox>
            <Tooltip placement="topLeft" title="任务回退时必须提交审批意见，对应的字段是comment">
              <Icon
                style={{cursor: "pointer"}}
                theme="filled"
                type="question-circle"
              />
            </Tooltip>
          </span>
        </div>
      </>
    );
  }
}

export default BackComment;
